﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage/MasterPage.master" AutoEventWireup="true"
    CodeFile="DriverList.aspx.cs" Inherits="TruckManage_DriverList" Title="司机列表" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div class="title">司机列表</div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table class="add_table" cellspacing="1" cellpadding="3" style="width: 70%" align="center">
                <tr>
                    <td align="right">编号：</td>
                    <td>
                        <asp:TextBox ID="txtCode" runat="server"></asp:TextBox>
                    </td>
                    <td align="right">状态：</td>
                    <td>
                        <asp:RadioButton ID="radAll" runat="server" Checked="true" Text="全部" GroupName="Status" />
                        <asp:RadioButton ID="radYes" runat="server" Text="有效" GroupName="Status" /><asp:RadioButton
                        ID="radNo" runat="server" Text="无效" GroupName="Status" />
                    </td>
                    <td align="center">
                        <asp:Button ID="btnSearch" runat="server" Text="搜索" class="btn" OnClick="btnSearch_Click"/>
                    </td>
                </tr>
            </table>
            <div class="list_title">
             <div class="autoleft">
                当前共有<asp:Label ID="lblTotal" runat="server"></asp:Label>条记录&nbsp;&nbsp;&nbsp;<a href="DriverEdit.aspx"><asp:Label
                    ID="lblDriverAdd" runat="server" Text="添加司机"></asp:Label></a></div>                   
                    <div class="autoright">                       
                        每页显示：
                        <asp:DropDownList ID="ddlPages" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPages_SelectedIndexChanged">
                            <asp:ListItem Selected="True" Text="10" Value="10"></asp:ListItem>
                            <asp:ListItem Text="15" Value="15"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                     </div>
            <asp:GridView ID="gvDriverList" runat="server" AllowPaging="True" PageSize="10" AutoGenerateColumns="False"
                Width="100%" OnPageIndexChanging="gvDriverList_PageIndexChanging" OnRowCommand="gvDriverList_RowCommand"
                OnSorting="gvDriverList_Sorting" AllowSorting="true" 
                onrowdatabound="gvDriverList_RowDataBound">
                <PagerTemplate>
                    <table style="width: 100%">
                        <tr>
                            <td>
                                页次:&nbsp;<asp:Label ID="Label1" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex+1 %>'></asp:Label>/<asp:Label
                                    ID="Label2" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>'></asp:Label>页&nbsp;
                                总计:&nbsp;<asp:Label ID="Label3" runat="server" Text="<%# ((System.Data.DataView)gvDriverList.DataSource).Count %>"></asp:Label>
                            </td>
                            <td align="right">
                                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Page" CommandArgument="First"
                                    Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>">首页</asp:LinkButton>
                                <asp:LinkButton ID="LinkButton2" runat="server" CommandArgument="Prev" CommandName="Page"
                                    Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>">前页</asp:LinkButton>
                                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Page" CommandArgument="Next"
                                    Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>">后页</asp:LinkButton>
                                <asp:LinkButton ID="LinkButton4" runat="server" CommandArgument="Last" CommandName="Page"
                                    Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>">尾页</asp:LinkButton>&nbsp;
                                <asp:Label ID="lblTurnOn" runat="server" Text="转第"></asp:Label><asp:TextBox ID="txtPages" runat="server" Width="35px"></asp:TextBox>
                                    <asp:Label ID="lblPages2" runat="server" Text="页"></asp:Label>
                                    <asp:LinkButton ID="lbtnGo" runat="server" Text="提交" onclick="lbtnGo_Click"></asp:LinkButton>
                            </td>
                        </tr>
                    </table>
                </PagerTemplate>
                <Columns>
                    <asp:TemplateField HeaderText="编号" SortExpression="Code">
                        <ItemTemplate>
                            <asp:Label ID="lblCode" runat="server" Text=' <%#  Eval("Code") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="姓名" SortExpression="Name">
                        <ItemTemplate>
                            <asp:Label ID="lblName" runat="server" Text=' <%#  Eval("Name") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="性别" SortExpression="Sex">
                        <ItemTemplate>
                            <asp:Label ID="lblSex" runat="server" Text=' <%#  HK2009.Common.StringUtil.GetSexName(Eval("Name")) %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="5%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="身份证" SortExpression="IDCard">
                        <ItemTemplate>
                            <asp:Label ID="lblIDCard" runat="server" Text=' <%#  Eval("IDCard") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="手机" SortExpression="MPhone">
                        <ItemTemplate>
                            <asp:Label ID="lblMPhone" runat="server" Text=' <%#  Eval("MPhone") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="驾照" SortExpression="Licence">
                        <ItemTemplate>
                            <asp:Label ID="lblLicence" runat="server" Text=' <%#  Eval("Licence") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="是否空闲" SortExpression="IsFree">
                        <ItemTemplate>
                            <asp:Label ID="lblIsFree" runat="server" Text=' <%#  HK2009.Common.StringUtil.GetYesNo(Eval("IsFree")) %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="状态" SortExpression="Status">
                        <ItemTemplate>
                            <asp:Label ID="lblStatus" runat="server" Text=' <%# HK2009.Common.StringUtil.GetStatus(Eval("Status")) %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="5%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="操作">
                        <ItemTemplate>
                            <a href="DriverEdit.aspx?PKID=<%# Eval("PKID")%>">
                                <asp:Label ID="lblUpdate" runat="server" Text="修改"></asp:Label></a>
                            <asp:LinkButton ID="lbtnDel" runat="server" Text="删除" CommandArgument='<%# Eval("PKID")%>'
                                OnClientClick="javascript:return confirm('确定要删除该记录？');" CommandName="Del"></asp:LinkButton>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle HorizontalAlign="Center" />
                <RowStyle HorizontalAlign="Center" />
            </asp:GridView>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>
